package com.bw.mapper;

import com.bw.bean.Cde;
import com.bw.bean.Vo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: lhy
 * @Date: 2025/3/18 08:17
 * @Description:
 **/
@Mapper
public interface VoMapper {
    @Select("select s.name,\n" +
            "       sum(oi.original_amount) value,\n" +
            "       count(oi.id) num1,\n" +
            "       count(distinct p.customer_id) num2,\n" +
            "       sum(oi.actual_amount) num3,\n" +
            "       sum(p.amount) num4\n" +
            " from shop s\n" +
            "left join order_info oi on s.id = oi.shop_id\n" +
            " left join payment p on oi.id = p.order_info_id and p.status=5\n" +
            "group by s.name")
    List<Cde> getList1();

    @Select("select  p.name,\n" +
            "        avg(oi.rating) value\n" +
            "from order_info oi\n" +
            "left join order_detail od on oi.id = od.order_info_id\n" +
            "left join product_sku ps on ps.id = od.product_sku_id\n" +
            "left join product_spu p on p.id = ps.product_spu_id\n" +
            "group by p.name having p.name is not null")
    List<Vo> getList2();
@Select("select  hour(create_time) name,sum(original_amount) value from order_info\n" +
        "group by hour(create_time)")
    List<Vo> getList3();
}
